package ggg;

import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class SeverDemo {

    public static void main(String[] args) throws IOException {
        ServerSocket ss = new ServerSocket(10001);

        Socket s = ss.accept();
        InputStream is = s.getInputStream();
        byte[] buf = new byte[1000];
        int length = is.read(buf);
        System.out.println("Information from " + s.getLocalAddress().getHostAddress() + " : " + new String(buf, 0, length));

        s.close();
    }

}
